/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package sistema.ecua911.interfaz;

import java.awt.Dimension;
import static java.lang.System.gc;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.table.DefaultTableModel;
import org.jvnet.substance.SubstanceLookAndFeel;
import org.jvnet.substance.button.StandardButtonShaper;
import sistema.ecua911.Exepciones.EstaVacioException;
import sistema.ecua911.Exepciones.NoesCaracteresException;
import sistema.ecua911.Exepciones.NoesDiezNumeros;
import sistema.ecua911.Exepciones.NoesNumeroExeption;
import sistema.ecua911.Exepciones.NullUserExeption;
import sistema.ecua911.Exepciones.UsuarioexistenteExeption;
import sistema.ecua911.Exepciones.Validaciones;
import sistema.ecua911.negocio.Bomberos;
import sistema.ecua911.negocio.Ciudad;
import sistema.ecua911.negocio.TipoEmergencia;
import sistema.ecua911.negocio.TipoEntidad;
import sistema.ecua911.negocio.Usuario;
import sistema.ecua911.negocio.gestores.GestorCiudad;
import sistema.ecua911.negocio.gestores.GestorEntidad;

import sistema.ecua911.negocio.gestores.GestorTipoEmergencia;
import sistema.ecua911.negocio.gestores.GestorUsuario;

import sistema.ecua911.negocio.gestores.GestorLlamada;
import sistema.ecua911.negocio.gestores.GestorTipoEntidad;

/**
 *
 * @author pablo
 */
public class VentanaUsuario extends javax.swing.JInternalFrame {

    /**
     * Creates new form VentanaUsuario
     */
    GestorUsuario gu;
    Mensajes mensajes;
    private int option;
    String ciudadSelecionada;
    DefaultTableModel model;
    DefaultTableModel model_entidades;
    String cedulaOperador = "3333333333";
    String ciudadSelect = "Cuenca";
    String tipoEntidadSelect = "Bomberos";
    HashMap<String, Integer> emergencias = new HashMap<String, Integer>();
    Validaciones validacion = new Validaciones();

    public VentanaUsuario(int option) {
        this.option = option;
        initComponents();
        mensajes = new Mensajes();
        model = new DefaultTableModel();
        model_entidades = new DefaultTableModel();
        jTable1.setModel(model);
        jtable_entidades.setModel(model_entidades);
        InicializarTabb();
        CargarCiudades();
        CargarTipoAlarma();
        redonderBotones();
        txtfecha.setText(getFechaActual());
        listar(); //lista usuariuos
        jTabbedPane1.setSelectedIndex(option);
        btregistrar.setEnabled(false);
        CargarTipoEntidad();
        listarEntidades(); //lista entodades

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jTextField8 = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        txtzona = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        txtcalle = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        txtnumero = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jboxciudades = new javax.swing.JComboBox();
        jLabel9 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        btguardaUsuario = new javax.swing.JButton();
        btnuevo_usuario = new javax.swing.JButton();
        bt_modifica_usuario = new javax.swing.JButton();
        bt_elimina_usuario = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        jLabel10 = new javax.swing.JLabel();
        txtcedula1 = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        txtnombre1 = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        txtapellido1 = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        txttelefono1 = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jButton2 = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        v = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        txtcedula = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        txtNombres = new javax.swing.JTextField();
        btregistrar = new javax.swing.JButton();
        jLabel14 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        txtfecha = new javax.swing.JTextField();
        jLabel25 = new javax.swing.JLabel();
        txtDireccion = new javax.swing.JTextField();
        jPanel6 = new javax.swing.JPanel();
        jLabel17 = new javax.swing.JLabel();
        comboTipos = new javax.swing.JComboBox();
        jLabel18 = new javax.swing.JLabel();
        jRadioButton1 = new javax.swing.JRadioButton();
        jRadioButton2 = new javax.swing.JRadioButton();
        jRadioButton3 = new javax.swing.JRadioButton();
        jPanel8 = new javax.swing.JPanel();
        lbTiposEmergencias = new javax.swing.JLabel();
        jPanel7 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        txtdescripcion = new javax.swing.JTextArea();
        btGenerar_llamada = new javax.swing.JButton();
        btLimpiarLlamada = new javax.swing.JButton();
        jLabel19 = new javax.swing.JLabel();
        jPanel9 = new javax.swing.JPanel();
        jLabel20 = new javax.swing.JLabel();
        jPanel10 = new javax.swing.JPanel();
        jLabel21 = new javax.swing.JLabel();
        txtnombre_entidad = new javax.swing.JTextField();
        jLabel22 = new javax.swing.JLabel();
        comboTipoEntidad = new javax.swing.JComboBox();
        jLabel23 = new javax.swing.JLabel();
        txtTelefono_entidad = new javax.swing.JTextField();
        jLabel24 = new javax.swing.JLabel();
        txtcorreo_entidad = new javax.swing.JTextField();
        jScrollPane3 = new javax.swing.JScrollPane();
        jtable_entidades = new javax.swing.JTable();
        jPanel11 = new javax.swing.JPanel();
        bt_elimina_entidad = new javax.swing.JButton();
        bt_modifica_entidad = new javax.swing.JButton();
        btnuevo_entidad = new javax.swing.JButton();
        btguardaentidad = new javax.swing.JButton();

        setClosable(true);
        setIconifiable(true);

        jTabbedPane1.setTabPlacement(javax.swing.JTabbedPane.LEFT);
        jTabbedPane1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jTabbedPane1.setOpaque(true);

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistema/ecua911/Imagenes/search_user (2).png"))); // NOI18N
        jButton1.setText("Limpiar");
        jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Direccion", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(255, 0, 0)));

        jLabel6.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel6.setText("Zona:");

        jLabel7.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel7.setText("Calle");

        txtcalle.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtcalleActionPerformed(evt);
            }
        });

        jLabel8.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel8.setText("Nro.");

        txtnumero.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtnumeroActionPerformed(evt);
            }
        });

        jLabel5.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel5.setText("Ciudad:");

        jboxciudades.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jboxciudades.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jboxciudadesActionPerformed(evt);
            }
        });
        jboxciudades.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jboxciudadesPropertyChange(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jboxciudades, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel6)
                            .addComponent(jLabel7))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(txtcalle, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel8)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtnumero, javax.swing.GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE))
                            .addComponent(txtzona))))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jboxciudades, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(txtzona, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(txtcalle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8)
                    .addComponent(txtnumero, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jLabel9.setText("Buscar:");

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jTable1.setShowVerticalLines(false);
        jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTable1MouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(jTable1);

        btguardaUsuario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistema/ecua911/Imagenes/user_accept (2).png"))); // NOI18N
        btguardaUsuario.setText("Guardar");
        btguardaUsuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btguardaUsuarioActionPerformed(evt);
            }
        });

        btnuevo_usuario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistema/ecua911/Imagenes/add_user_1.png"))); // NOI18N
        btnuevo_usuario.setText("Nuevo");
        btnuevo_usuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnuevo_usuarioActionPerformed(evt);
            }
        });

        bt_modifica_usuario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistema/ecua911/Imagenes/edit_profile (2).png"))); // NOI18N
        bt_modifica_usuario.setText("Modificar");

        bt_elimina_usuario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistema/ecua911/Imagenes/delete_user (2).png"))); // NOI18N
        bt_elimina_usuario.setText("Eliminar");
        bt_elimina_usuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bt_elimina_usuarioActionPerformed(evt);
            }
        });

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Informacion", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(255, 0, 0)));

        jLabel10.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel10.setText("Cedula:");

        txtcedula1.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                txtcedula1CaretUpdate(evt);
            }
        });

        jLabel11.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel11.setText("Nombre:");

        jLabel12.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel12.setText("Apellido:");

        jLabel13.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel13.setText("Telefono:");

        txttelefono1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txttelefono1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel11, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel12, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel13, javax.swing.GroupLayout.Alignment.TRAILING))
                .addGap(4, 4, 4)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtcedula1, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtnombre1)
                    .addComponent(txtapellido1)
                    .addComponent(txttelefono1, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(txtcedula1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(txtnombre1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel12)
                    .addComponent(txtapellido1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13)
                    .addComponent(txttelefono1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistema/ecua911/Imagenes/add_user (5).png"))); // NOI18N

        jButton2.setText("Cerrar");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 183, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel9)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextField8)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jScrollPane1))
                .addContainerGap())
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(54, 54, 54)
                .addComponent(bt_elimina_usuario, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(45, 45, 45)
                .addComponent(bt_modifica_usuario, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(33, 33, 33)
                .addComponent(btnuevo_usuario, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btguardaUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jButton2))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel9)
                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jTextField8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, 16, Short.MAX_VALUE)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(btnuevo_usuario, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(bt_modifica_usuario, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(bt_elimina_usuario, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(btguardaUsuario, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addContainerGap(22, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jButton2))))
        );

        jTabbedPane1.addTab("Usuarios", jPanel1);

        v.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Datos Usuario", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(255, 0, 0)));

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel2.setText("Cedula:");

        txtcedula.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                txtcedulaCaretUpdate(evt);
            }
        });

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel3.setText("Nombres:");

        txtNombres.setEnabled(false);

        btregistrar.setText("Registrar");
        btregistrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btregistrarActionPerformed(evt);
            }
        });

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel4.setText("Fecha: ");

        jLabel25.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel25.setText("Direccion:");

        javax.swing.GroupLayout vLayout = new javax.swing.GroupLayout(v);
        v.setLayout(vLayout);
        vLayout.setHorizontalGroup(
            vLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(vLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(vLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel25, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(vLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtDireccion, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(vLayout.createSequentialGroup()
                        .addComponent(txtcedula, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btregistrar))
                    .addComponent(txtNombres)
                    .addComponent(txtfecha))
                .addContainerGap())
            .addGroup(vLayout.createSequentialGroup()
                .addGap(240, 240, 240)
                .addComponent(jLabel14)
                .addGap(10, 10, 10))
        );
        vLayout.setVerticalGroup(
            vLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(vLayout.createSequentialGroup()
                .addContainerGap(17, Short.MAX_VALUE)
                .addGroup(vLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(txtcedula, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btregistrar))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(vLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtNombres, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel14)
                .addGap(7, 7, 7)
                .addGroup(vLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel25)
                    .addComponent(txtDireccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(vLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel4)
                    .addComponent(txtfecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(32, 32, 32))
        );

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Alarma", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(255, 0, 0)));

        jLabel17.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel17.setText("Tipo Alarma:");

        comboTipos.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        comboTipos.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                comboTiposItemStateChanged(evt);
            }
        });

        jLabel18.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel18.setText("Nivel:");

        jRadioButton1.setText("Bajo");

        jRadioButton2.setText("Medio");

        jRadioButton3.setText("Alto");

        jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Entidades a Llamar", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(255, 0, 0)));

        lbTiposEmergencias.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        lbTiposEmergencias.setText("jLabel20");
        lbTiposEmergencias.setAutoscrolls(true);

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(lbTiposEmergencias, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(lbTiposEmergencias, javax.swing.GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel18)
                            .addComponent(jLabel17))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(comboTipos, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGroup(jPanel6Layout.createSequentialGroup()
                                .addComponent(jRadioButton1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jRadioButton2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jRadioButton3)
                                .addGap(0, 26, Short.MAX_VALUE))))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel17)
                    .addComponent(comboTipos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(jRadioButton1)
                    .addComponent(jRadioButton2)
                    .addComponent(jRadioButton3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Descripcion", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(255, 0, 0)));

        txtdescripcion.setColumns(20);
        txtdescripcion.setRows(5);
        jScrollPane2.setViewportView(txtdescripcion);

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane2)
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(25, 25, 25))
        );

        btGenerar_llamada.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistema/ecua911/Imagenes/save (3).png"))); // NOI18N
        btGenerar_llamada.setText("Generar LLamada");
        btGenerar_llamada.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btGenerar_llamadaActionPerformed(evt);
            }
        });

        btLimpiarLlamada.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistema/ecua911/Imagenes/Document 1.png"))); // NOI18N
        btLimpiarLlamada.setText("Limpiar");

        jLabel19.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistema/ecua911/Imagenes/llamadas.png"))); // NOI18N

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel19, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(v, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(12, 12, 12)))
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addGap(76, 76, 76)
                .addComponent(btLimpiarLlamada, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btGenerar_llamada, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(62, 62, 62))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(v, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btLimpiarLlamada)
                    .addComponent(btGenerar_llamada))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Llamadas", jPanel2);

        jLabel20.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistema/ecua911/Imagenes/1072-17.png"))); // NOI18N
        jLabel20.setText("jLabel20");

        jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Informacion", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(255, 0, 0)));

        jLabel21.setText("Nombre:");

        jLabel22.setText("Tipo:");

        comboTipoEntidad.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        comboTipoEntidad.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                comboTipoEntidadItemStateChanged(evt);
            }
        });

        jLabel23.setText("Telefono:");

        jLabel24.setText("Correo:");

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel21, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel22, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel23, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel24, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtnombre_entidad)
                    .addComponent(comboTipoEntidad, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(txtTelefono_entidad)
                    .addComponent(txtcorreo_entidad, javax.swing.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel21)
                    .addComponent(txtnombre_entidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel22)
                    .addComponent(comboTipoEntidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel23)
                    .addComponent(txtTelefono_entidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel24)
                    .addComponent(txtcorreo_entidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jtable_entidades.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jtable_entidades.setShowVerticalLines(false);
        jScrollPane3.setViewportView(jtable_entidades);

        jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Responsable", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(255, 51, 51)));

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        jPanel11Layout.setVerticalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        bt_elimina_entidad.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistema/ecua911/Imagenes/delete_user (2).png"))); // NOI18N
        bt_elimina_entidad.setText("Eliminar");

        bt_modifica_entidad.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistema/ecua911/Imagenes/edit_profile (2).png"))); // NOI18N
        bt_modifica_entidad.setText("Modificar");

        btnuevo_entidad.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistema/ecua911/Imagenes/add_user_1.png"))); // NOI18N
        btnuevo_entidad.setText("Nuevo");
        btnuevo_entidad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnuevo_entidadActionPerformed(evt);
            }
        });

        btguardaentidad.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistema/ecua911/Imagenes/user_accept (2).png"))); // NOI18N
        btguardaentidad.setText("Guardar");
        btguardaentidad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btguardaentidadActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 706, Short.MAX_VALUE)))
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(bt_elimina_entidad, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(45, 45, 45)
                .addComponent(bt_modifica_entidad, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(33, 33, 33)
                .addComponent(btnuevo_entidad, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btguardaentidad, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(62, 62, 62))
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(bt_elimina_entidad, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btguardaentidad, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(bt_modifica_entidad, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnuevo_entidad, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        jTabbedPane1.addTab("Entidades", jPanel9);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jboxciudadesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jboxciudadesActionPerformed
        //ciudadSelecionada=jboxciudades.getSelectedItem().toString();
    }//GEN-LAST:event_jboxciudadesActionPerformed

    private void txtcalleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtcalleActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtcalleActionPerformed

    private void txtnumeroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtnumeroActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtnumeroActionPerformed

    private void txtcedulaCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_txtcedulaCaretUpdate
        if (txtcedula.getText().length() == 10) {

            try {
                gu = new GestorUsuario();
                Usuario u = (Usuario) gu.buscar(txtcedula.getText().trim());
                if (u == null) {
                    btregistrar.setEnabled(true);

                } else {
                    txtNombres.setText(u.getNombre().toUpperCase() + " " + u.getApellido().toUpperCase());
                    txtDireccion.setText(u.getDirecion().getZona().toUpperCase() + ", " + u.getDirecion().getCalle().toUpperCase());
                    btregistrar.setEnabled(false);
                }
            } catch (SQLException ex) {
                Logger.getLogger(VentanaUsuario.class.getName()).log(Level.SEVERE, null, ex);
            }

        } else {
            txtNombres.setText("");
            txtDireccion.setText("");
        }
    }//GEN-LAST:event_txtcedulaCaretUpdate

    private void txttelefono1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txttelefono1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txttelefono1ActionPerformed

    private void btguardaUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btguardaUsuarioActionPerformed
        String mensaje = "";
        try {
            mensaje = "Se guardo Sastifactorimente";
            GuardarUsuario();
            mensajes.mensaje(mensaje, 1);
        } catch (UsuarioexistenteExeption ex) {
            mensajes.mensaje(ex.getMessage(), 2);
        } catch (SQLException ex) {
            mensajes.mensaje(ex.getMessage(), 2);
        } catch (NullUserExeption ex) {
            mensajes.mensaje(ex.getMessage(), 2);
        } catch (NoesDiezNumeros ex) {
            mensajes.mensaje(ex.getMessage(), 2);
        } catch (NoesNumeroExeption ex) {
            mensajes.mensaje(ex.getMessage(), 2);
        } catch (NoesCaracteresException ex) {
            mensajes.mensaje(ex.getMessage(), 2);
        } catch (EstaVacioException ex) {
            mensajes.mensaje(ex.getMessage(), 2);
        } finally {

        }
    }//GEN-LAST:event_btguardaUsuarioActionPerformed

    private void btregistrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btregistrarActionPerformed
        jTabbedPane1.setSelectedIndex(0);
        txtcedula1.setText(txtcedula.getText());
    }//GEN-LAST:event_btregistrarActionPerformed

    private void jboxciudadesPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jboxciudadesPropertyChange
        ciudadSelecionada = (String) jboxciudades.getSelectedItem();

    }//GEN-LAST:event_jboxciudadesPropertyChange

    private void txtcedula1CaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_txtcedula1CaretUpdate
        // TODO add your handling code here:
    }//GEN-LAST:event_txtcedula1CaretUpdate

    private void comboTiposItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_comboTiposItemStateChanged
        String valores = new String("");
        int n = comboTipos.getSelectedIndex();
        if (n > 0) {
            valores = (String) comboTipos.getSelectedItem();
            emergencias.put(valores, n + 1);
            mostrarEmergencias(emergencias);
        }


    }//GEN-LAST:event_comboTiposItemStateChanged

    private void btGenerar_llamadaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btGenerar_llamadaActionPerformed
        try {
            guardarLlamada();
        } catch (SQLException ex) {
            Logger.getLogger(VentanaUsuario.class.getName()).log(Level.SEVERE, null, ex);
        }

    }//GEN-LAST:event_btGenerar_llamadaActionPerformed

    private void btguardaentidadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btguardaentidadActionPerformed
        try {
            this.guardarEntidades();
            mensajes.mensaje("Entidad Guardada Sastifactorimente.. ", 1);
        } catch (NoesCaracteresException ex) {
            mensajes.mensaje(ex.getMessage(), 2);
        } catch (EstaVacioException ex) {
            mensajes.mensaje(ex.getMessage(), 2);
        } catch (SQLException ex) {
            mensajes.mensaje(ex.getMessage(), 2);
        }
    }//GEN-LAST:event_btguardaentidadActionPerformed

    private void comboTipoEntidadItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_comboTipoEntidadItemStateChanged
        tipoEntidadSelect = (String) comboTipoEntidad.getSelectedItem();
    }//GEN-LAST:event_comboTipoEntidadItemStateChanged

    private void btnuevo_usuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnuevo_usuarioActionPerformed
        Limpiar_Usuario();
        Bloquear_Usuario(true);
    }//GEN-LAST:event_btnuevo_usuarioActionPerformed

    private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked

        int rowSelect = jTable1.getSelectedRow();
        if (rowSelect != -1) {
            txtcedula1.setText((String) jTable1.getValueAt(rowSelect, 0));
            txtnombre1.setText((String) jTable1.getValueAt(rowSelect, 1));
            txtapellido1.setText((String) jTable1.getValueAt(rowSelect, 2));
            txttelefono1.setText((String) jTable1.getValueAt(rowSelect, 3));
            txtzona.setText((String) jTable1.getValueAt(rowSelect, 5));
            txtcalle.setText((String) jTable1.getValueAt(rowSelect, 6));
            txtnumero.setText((String) jTable1.getValueAt(rowSelect, 7));

        }
    }//GEN-LAST:event_jTable1MouseClicked

    private void btnuevo_entidadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnuevo_entidadActionPerformed
        limpiarEntidad();
        bloquearEntidad(true);
    }//GEN-LAST:event_btnuevo_entidadActionPerformed

    private void bt_elimina_usuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_elimina_usuarioActionPerformed
        eliminarUsuario();


    }//GEN-LAST:event_bt_elimina_usuarioActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
       this.dispose();
    }//GEN-LAST:event_jButton2ActionPerformed
    public void redonderBotones() {
        this.btnuevo_usuario.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new StandardButtonShaper());
        this.btguardaUsuario.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new StandardButtonShaper());
        this.bt_elimina_usuario.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new StandardButtonShaper());
        this.bt_modifica_usuario.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new StandardButtonShaper());
        this.btGenerar_llamada.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new StandardButtonShaper());
        this.btLimpiarLlamada.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new StandardButtonShaper());
        this.bt_elimina_entidad.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new StandardButtonShaper());
        this.btguardaentidad.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new StandardButtonShaper());
        this.bt_modifica_entidad.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new StandardButtonShaper());
        this.btnuevo_entidad.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new StandardButtonShaper());

    }

    public void mostrarEmergencias(HashMap<String, Integer> valores) {
        String valor = "";
        for (String c : valores.keySet()) {
            valor += c + ", ";

        }
        lbTiposEmergencias.setText(valor);
    }

    public void cambiarPestana(int op) {
        jTabbedPane1.setSelectedIndex(op);
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btGenerar_llamada;
    private javax.swing.JButton btLimpiarLlamada;
    private javax.swing.JButton bt_elimina_entidad;
    private javax.swing.JButton bt_elimina_usuario;
    private javax.swing.JButton bt_modifica_entidad;
    private javax.swing.JButton bt_modifica_usuario;
    private javax.swing.JButton btguardaUsuario;
    private javax.swing.JButton btguardaentidad;
    private javax.swing.JButton btnuevo_entidad;
    private javax.swing.JButton btnuevo_usuario;
    private javax.swing.JButton btregistrar;
    private javax.swing.JComboBox comboTipoEntidad;
    private javax.swing.JComboBox comboTipos;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JRadioButton jRadioButton1;
    private javax.swing.JRadioButton jRadioButton2;
    private javax.swing.JRadioButton jRadioButton3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable jTable1;
    private javax.swing.JTextField jTextField8;
    private javax.swing.JComboBox jboxciudades;
    private javax.swing.JTable jtable_entidades;
    private javax.swing.JLabel lbTiposEmergencias;
    private javax.swing.JTextField txtDireccion;
    private javax.swing.JTextField txtNombres;
    private javax.swing.JTextField txtTelefono_entidad;
    private javax.swing.JTextField txtapellido1;
    private javax.swing.JTextField txtcalle;
    private javax.swing.JTextField txtcedula;
    private javax.swing.JTextField txtcedula1;
    private javax.swing.JTextField txtcorreo_entidad;
    private javax.swing.JTextArea txtdescripcion;
    private javax.swing.JTextField txtfecha;
    private javax.swing.JTextField txtnombre1;
    private javax.swing.JTextField txtnombre_entidad;
    private javax.swing.JTextField txtnumero;
    private javax.swing.JTextField txttelefono1;
    private javax.swing.JTextField txtzona;
    private javax.swing.JPanel v;
    // End of variables declaration//GEN-END:variables

    private void InicializarTabb() {
        jTabbedPane1.setIconAt(0, new ImageIcon("/sistema/ecua911/Imagenes/user.png"));
    }

    public void GuardarUsuario() throws UsuarioexistenteExeption, SQLException, NullUserExeption, NoesDiezNumeros, NoesNumeroExeption, NoesCaracteresException, EstaVacioException {
        //jTabbedPane1.remove(2);
        gu = new GestorUsuario();
        String cedula, nombre, apellido, telefono, zona, calle, numero;
        cedula = txtcedula1.getText();
        nombre = txtnombre1.getText();
        apellido = txtapellido1.getText();
        telefono = txttelefono1.getText();
        zona = txtzona.getText();
        calle = txtcalle.getText();
        numero = txtnumero.getText();
        validacion.validarcedula(cedula, "Cedula");
        if (gu.buscar(cedula) != null) {
            throw new UsuarioexistenteExeption("El Usuario Ya Existe");
        }
        validacion.esPalabraCaracteres(nombre, "Nombre");
        validacion.esPalabraCaracteres(apellido, "Apellido");
        validacion.vacio(telefono, "Telefono");
        validacion.vacio(zona, "Zona");
        validacion.vacio(calle, "calle");

        gu.Grabar(cedula, nombre, apellido, telefono, ciudadSelecionada, zona, calle, numero);

        listar();

        Limpiar_Usuario();
        Bloquear_Usuario(false);

    }

    private void eliminarUsuario() {

        gu.Eliminar(this.txtcedula.getText());

    }

    public void listar() {//metodo para cargar datos en la tabla
        String[] titulos = {"Cedula", "Nombre", "Apellido", "Telefono", "Ciudad", "Zona", "Calle", "Nro"};
        gu = new GestorUsuario();
        try {
            model.setDataVector(gu.Listar().darTablaEntera(), titulos);
        } catch (SQLException ex) {
            Logger.getLogger(VentanaUsuario.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    //cargar en la lista las ciudades
    public void CargarCiudades() {
        GestorCiudad gc = new GestorCiudad();
        jboxciudades.removeAllItems();
        try {
            for (Ciudad c : gc.getCiudades()) {
                jboxciudades.addItem(c.getNombre());
            }
        } catch (SQLException ex) {
            Logger.getLogger(VentanaUsuario.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    ///limpar los botones
    public void Limpiar_Usuario() {
        txtcedula1.setText("");
        txtnombre1.setText("");
        txtapellido1.setText("");
        txttelefono1.setText("");
        txtzona.setText("");
        txtcalle.setText("");
        txtnumero.setText("");

    }

    ///bloaur los botoners
    public void Bloquear_Usuario(boolean f) {
        txtcedula1.setEnabled(f);
        txtnombre1.setEnabled(f);
        txtapellido1.setEnabled(f);
        txttelefono1.setEnabled(f);
        txtzona.setEnabled(f);
        txtcalle.setEnabled(f);
        txtnumero.setEnabled(f);
    }
    //----------------------Metodos para las LLamadas------------------------------

    public void guardarLlamada() throws SQLException {
        ArrayList<TipoEmergencia> TipoEmergencias = new ArrayList<>();
        GestorLlamada gllamada = new GestorLlamada();
        String cedulaUsuario, cedulaOperador, descripcion, fecha, tipoEmergencia;
        cedulaUsuario = txtcedula.getText();
        cedulaOperador = this.cedulaOperador;
        fecha = txtfecha.getText();
        descripcion = txtdescripcion.getText();
        //  public void guardar(String cedulaUser,String cedulaOperador,Date fecha,String desc,ArrayList<TipoEmergencia>  tipos,Direccion dir) throws SQLException{
        GestorTipoEmergencia gEmergencia = new GestorTipoEmergencia();
        for (String c : emergencias.keySet()) {

            TipoEmergencia nombreAlarma = gEmergencia.buscar(c);
            TipoEmergencias.add(nombreAlarma);
        }
        gllamada.guardar(cedulaUsuario, cedulaOperador, fecha, descripcion, TipoEmergencias, 5);
        gllamada.llamarEntidades(emergencias);
    }

    //cargar lista de tipo de alarmas
    public void CargarTipoAlarma() {
        try {
            GestorTipoEmergencia gtipo = new GestorTipoEmergencia();
            comboTipos.removeAllItems();
            comboTipos.addItem("Selecione Emergencia");
            for (TipoEmergencia e : gtipo.getTiposEmergencias()) {
                comboTipos.addItem(e.getDescripcion());

            }
        } catch (SQLException ex) {
            Logger.getLogger(VentanaUsuario.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public static String getFechaActual() {
        Date fecha = new Date();
        SimpleDateFormat formateador = new SimpleDateFormat("dd-MM-yyyy");
        return formateador.format(fecha);
    }
    //------------------------------  para las entidades -------------------------------------

    public void guardarEntidades() throws NoesCaracteresException, EstaVacioException, SQLException {
        // public EntidadCooperacion(String nombre, Direccion direccion, String Email, String telefono, String ciudad, Responsable responsable) {
        GestorEntidad gentidad = new GestorEntidad();
        String nombre, correo, telefono, direccion;
        nombre = txtnombre_entidad.getText();
        correo = txtcorreo_entidad.getText();
        telefono = txtTelefono_entidad.getText();
        validacion.esPalabraCaracteres(nombre, "Nombre");
        validacion.vacio(correo, "Correo");
        validacion.vacio(telefono, "Telefono");
        gentidad.grabar(nombre, null, correo, telefono, "ceunca", tipoEntidadSelect, null);
        limpiarEntidad();
        listarEntidades();
        bloquearEntidad(false);
    }

    public void limpiarEntidad() {
        txtnombre_entidad.setText("");
        txtcorreo_entidad.setText("");
        txtTelefono_entidad.setText("");
    }

    public void bloquearEntidad(boolean f) {
        txtnombre_entidad.setEnabled(f);
        txtcorreo_entidad.setEnabled(f);
        txtTelefono_entidad.setEnabled(f);
    }

    public void listarEntidades() {
        String[] titulos = {"Nombre", "Correo", "Telefono", "Ciudad", "Tipo", "Zona", "Calle"};
        GestorEntidad gentidad = new GestorEntidad();
        try {
            model_entidades.setDataVector(gentidad.Listar().darTablaEntera(), titulos);
        } catch (SQLException ex) {
            Logger.getLogger(VentanaUsuario.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void CargarTipoEntidad() {
        GestorTipoEntidad gTipoEntidad = new GestorTipoEntidad();
        comboTipoEntidad.removeAllItems();
        try {
            for (TipoEntidad c : gTipoEntidad.getTipoEntidades()) {
                comboTipoEntidad.addItem(c.getDescripcion());
            }
        } catch (SQLException ex) {
            Logger.getLogger(VentanaUsuario.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    //////////////////sobre llamada ah entidades////////////////
    public int llamadaentidades(int codigo) {

        return 0;
    }
}
